package tech.dongliang.common.exception;

import tech.dongliang.common.error.CommonError;

public class BizException extends RuntimeException implements CommonError {
    private CommonError commonError;

    public BizException(CommonError commonError) {
        super();
        this.commonError = commonError;
    }

    public BizException(CommonError commonError, String errMsg) {
        super();
        this.commonError = commonError;
        this.commonError.setErrMsg(errMsg);
    }

    @Override
    public Integer getErrCode() {
        return commonError.getErrCode();
    }

    @Override
    public String getErrMsg() {
        return commonError.getErrMsg();
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.commonError.setErrMsg(errMsg);
        return this;
    }
}
